package com.ferry.transport.netty.provider;

import com.ferry.common.util.Pair;
import com.ferry.registry.domain.service.ServiceMetaData;

import java.util.List;
import java.util.Map;

/**
 * Created by daiyong
 */
public class ServiceWrapper {
	// 服务元数据
	private ServiceMetaData metadata;
	// 服务对象
	private Object serviceProvider;

	private Map<String, List<Pair<Class<?>[], Class<?>[]>>> extensions;

	public ServiceWrapper() {
	}
	public ServiceWrapper(ServiceMetaData metadata, Object serviceProvider) {
		this.metadata = metadata;
		this.serviceProvider = serviceProvider;
	}

	public ServiceMetaData getMetadata() {
		return metadata;
	}

	public Object getServiceProvider() {
		return serviceProvider;
	}

	public void setMetadata(ServiceMetaData metadata) {
		this.metadata = metadata;
	}

	public void setServiceProvider(Object serviceProvider) {
		this.serviceProvider = serviceProvider;
	}

	public Map<String, List<Pair<Class<?>[], Class<?>[]>>> getExtensions() {
		return extensions;
	}

	public void setExtensions(Map<String, List<Pair<Class<?>[], Class<?>[]>>> extensions) {
		this.extensions = extensions;
	}

	public List<Pair<Class<?>[], Class<?>[]>> getMethodExtension(String methodName) {
		return extensions.get(methodName);
	}
}
